package com.sdleyou.treepro.common.rabbitmq.consumer;

import com.sdleyou.treepro.common.rabbitmq.event.StepChangeEvent;
import com.sdleyou.treepro.common.rabbitmq.event.TreeChangeEvent;
import com.sdleyou.treepro.common.rabbitmq.message.StepChangeMsg;
import com.sdleyou.treepro.common.rabbitmq.message.TreeChangeMsg;
import com.sdleyou.treepro.common.service.UserAchievementManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 树木变化消费者
 */
@Component
public class TreeChangeConsumer implements TreeChangeEvent {

    @Autowired
    private UserAchievementManager userAchievementManager;

    /**
     * 更新树木
     * @param treeChangeMsg
     */
    @Override
    public void treeChange(TreeChangeMsg treeChangeMsg) {
        userAchievementManager.updateTotalTree(treeChangeMsg.getTree());
    }
}
